package com.luweijie.controller;

import com.luweijie.config.AccessTokenConfig;
import com.luweijie.config.AuthorizationServer;
import com.luweijie.config.SecurityConfig;
import com.luweijie.mappre.UserMapper;
import com.luweijie.pojo.User;
import com.luweijie.security.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.crypto.factory.PasswordEncoderFactories;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.security.oauth2.provider.OAuth2Authentication;
import org.springframework.web.bind.annotation.*;

import javax.lang.model.SourceVersion;

@RestController

public class LoginController {
    @Autowired
    UserMapper userDao;



    @GetMapping("/admin/hello")
    public String admin() {

        String pass = "123456";
        PasswordEncoder passwordEncoder = PasswordEncoderFactories.createDelegatingPasswordEncoder();
        String hashPass2 = passwordEncoder.encode(pass);    // {bcrypt}$2a$10$wr1V8zCDSvnXNgZZkKSRIOIRZJLt885I/ZyoNf3RA0k1zVS3LbHWu
        System.out.println(hashPass2);

          return "admin";
    }



}

